
$(function () {
    $("#list").datagrid({
        method: "post",
        url: getRootPath() + "/mtManage/assets/list_assetsBalance",
        fit: true,
        border: true,
        pageNumber: 1,
        pageSize: 20,
        pageList: [10, 20, 30, 50, 100],
        columns: [[
            {field:'ck',checkbox:true},
            {field: "type_dtl_id", title: "物料ID", width: 80},
            {field: "type_dtl_name", title: "物料名称", width: 180,formatter:columShow},
            {field: "type_dtl_no", title: "物料编码", width: 120},
            {field: "k3_code", title: "K3编码", width: 120},
            {field: "sizes", title: "物料规格", width: 200,
                formatter:function (value) {
                    if (value!=null)
                    { return "<span title='" + value + "'>" + value + "</span>";}
                    else
                    {return "";}
                }
            },
            {field: "receipt", title: "入库总量", width: 80,
                formatter(value)
                {
                    if (value==null)
                    {return "0";}
                    else
                    {return value;}
                }
            },
            {field: "delivery", title: "出库总量", width: 80,
                formatter(value)
                {
                    if (value==null)
                    {return "0";}
                    else
                    {return value;}
                }
            },
            {field: "balance", title: "剩余数量", width: 80,
                formatter(value)
                {
                    if (value==null)
                    {return "0";}
                    else
                    {return value;}
                }

            },
            {field: "unit", title: "单位", width: 40},
        ]],
        onLoadSuccess: function (data) {
            $('.button-delete').linkbutton({});
            $('.button-edit').linkbutton({});
        },
        pagination: true,
        striped: true,
        singleSelect:true,
        //工具条
        toolbar: "#toolbar",
    });

});

//单元格扩展悬浮显示功能
var columShow = function colum_Show(value,row,index){
    return '<span title='+value+'>'+value+'</span>';
}

// 记录查询
function queryRecord() {
    $("#list").datagrid('load', {
        type_dtl_no:$("#type_dtl_no").val(),
        type_dtl_name:$("#type_dtl_name").val()
        }
    );
}